﻿<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Graph</title>
	<link rel="stylesheet" type="text/css" href="../css/mystyle.css" />
	<link rel="stylesheet" href="tc_calendar.php"/>
</head>

<body>
	<div id="mainWrapper">
        <div id="graph">
            <form method="post">
            <table>
                <tr>
                    <td> Năm <input type="text" name="nam"/></td>
                </tr>
                <tr>
                    <td><input type="submit" name="submit" id="submit" value="Select"/></td>
                </tr>
            </table>
            <br /> <br />
                <?php
                if(isset($_POST['submit'])) {
                $out='Biểu đồ số lượng hàng hóa bán ra trong năm '. $_POST['nam'];

                echo $out;
                }
                ?>
            </form>
            <br /></br /><br />
        </div>
</body>
<?php
if(isset($_POST['submit'])) {
$conn=mysql_connect('localhost','root','') or die(mysql_error());
	mysql_select_db('thuctap');
		if(isset($_POST['submit']))
		//$year = $_POST["nam"];
		$fetch=mysql_query("select MASP, sum(SLBAN)
			from chitietban
			where MAHDB in (select id
			from hoadonban
			where year(NGAYBAN)='".$_POST['nam']."')
			group by MASP");
        echo "<div id='char'><ul>";
		while($rows=mysql_fetch_array($fetch))
		{
			$name=$rows['MASP'];
			$height1=$rows['sum(SLBAN)'];
			$ratings=$height1;
			$output = '<li>
				<br />
				'.$ratings.'
				<br />
				<img src="../images/capture.png" height="' .$height1.'"width="18" alt="" />
				<br />
				SP'.$name. '
				</li>';
			echo $output;
		}
        echo "</div></ul> ";
    echo "</div>";
}
?>